package com.cyandpos.pad.pay.presenter;


import com.cyandpos.pad.pay.model.ICashCollectionModel;
import com.cyandpos.pad.pay.model.ICashCollectionModelImpl;
import com.cyandpos.pad.pay.view.ICashCollectionView;
import com.cyandpos.pad.posdata.Payment;
import com.cyandpos.pad.sale.model.ICashMainSaleModel;
import com.cyandpos.pad.sale.model.ICashMainSaleView;
import com.cyandpos.pad.sale.model.IMainSaleModelImpl;

import java.util.List;

/**
 * 款台收款方式 Presenter
 */

public class CashCollectionPresenter {
    ICashCollectionView payView;
    ICashMainSaleView mainSaleView;
    ICashCollectionModel payModel = new ICashCollectionModelImpl();
    IMainSaleModelImpl mainSaleModel = new IMainSaleModelImpl();

    public CashCollectionPresenter(ICashCollectionView mPayView){
        this.payView = mPayView;
    }

    public CashCollectionPresenter(ICashMainSaleView mMainSaleView){
        this.mainSaleView = mMainSaleView;
    }

    public void getPaymentList(){

        if(payModel!=null){
            payModel.loadPayData(new ICashCollectionModel.PayOnLoadListener(){
                @Override
                public void onComplete(List<Integer> imgs, List<Integer> select_imgs, List<Payment> skfs) {
                    payView.showPaymetListData(imgs,select_imgs,skfs);
                }
            });
        }
    }
    public void getnMainSaleList(String[] context){

        if(mainSaleModel!=null){
            mainSaleModel.loadPayData(context,new ICashMainSaleModel.PayOnLoadListener(){
                @Override
                public void onComplete(List<Integer> imgs, List<Integer> select_imgs, List<String> names) {
                    mainSaleView.showPaymetListData(imgs,select_imgs,names);
                }
            });
        }
    }
}
